package com.fansl.allround.oss.api.feign;

import com.fansl.allround.common.core.constant.ServiceNameConstants;
import com.fansl.allround.oss.api.feign.factory.RemoteQiniuOssServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author fansl
 * @Description: TODO
 * @date 2019/9/3 17:10
 */
@FeignClient(serviceId = "remoteQiniuOssService",name = ServiceNameConstants.OSS_SERVICE,fallbackFactory = RemoteQiniuOssServiceFallbackFactory.class)
public interface RemoteQiniuOssService {
    /**
     * 获取下载的文件地址
     * @param isPrivate 是否是私有空间
     * @param key 文件key
     * @return
     */
    @PostMapping("/downloadUrl")
    String getDownloadUrl(@RequestParam Boolean isPrivate,@RequestParam String key);

    /**
     * 获取下载的文件地址
     * @param isPrivate 是否是私有空间
     * @param keys 文件key
     * @return
     */
    @PostMapping("/list/downloadUrl")
    Map<String,String> getDownloadUrl(@RequestParam Boolean isPrivate,
                                             @RequestBody List<String> keys);
}
